Table of Contents

Integrating Interacta for your Framework

Interacta is designed as a collection of abstract generic classes, allowing for flexible integration with various player controllers. To use Interacta with your specific player setup and make it visible in the Unity Inspector, you'll need to create concrete implementations. This process is straightforward and involves creating a few simple scripts inheriting from our base classes.

Implementing InteractaCore

Create a new script inheriting from InteractaCore<T>, replace T with your Player Script Type.

For instance: if your player type is FirstPersonController, your script will be:

public class Interacta : InteractaCore<FirstPersonController>
{

}
  • Attach this script onto your MainCamera, CinemachineCamera or the player object.

Interacta Component

  • Set the layers used for occlusion (world objects)
  • Set the layers used for interaction (Interactable Objects)
  • It's recommended to exclude the 'Ignore Raycast' layer from the occlusion mask
  • Attach Camera and Player References

Implementing IInteractableBase

While it's possible to use IInteractableBase<PlayerType> as is, it is recommended to create a wrapper. This saves you typing time and is less error prone. Create a new interface script implementing InteractaCore<T>, replace T with your Player Script Type.

public interface IInteractable : IInteractableBase<FirstPersonController>
{

}

About the Interface

When unsure, check code documentation or sample scripts from the demo scene.

/// <summary>
/// Called when player interacts with the object.
/// </summary>
/// <param name="player">Reference to your playerController object.</param>
public void OnInteract(T player);

/// <summary>
/// Returns the title shown when player looks at the object.
/// Run any custom logic here to determine the title. Returning null will exclude this object from showing up.
/// </summary>
/// <param name="player">Reference to the interacting playerComponent</param>
/// <returns>Title to show when looking at object</returns>
public string GetTitle(T player);